package com.zd.web.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.zd.entity.Novel2;
import com.zd.service.BookService;
import com.zd.service.impl.BookServiceImpl;

@WebServlet("/selectBookByTypeServlet")
public class SelectBookByTypeServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
    private BookService bookService = new BookServiceImpl();
    public SelectBookByTypeServlet() {
        super(); 
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String typeName = request.getParameter("typeName");
		List<Novel2> novels = bookService.selectNovelByType(typeName);
//		System.out.println(typeName);
//		List<Novel2> linovels=bookService.selectli(typeName);
//		List<Novel2> divnovels=bookService.selectdiv(typeName);
		request.setAttribute("list", novels);
//		request.setAttribute("linovels", linovels);
//		request.setAttribute("divnovels", divnovels);
		request.getRequestDispatcher("fl.jsp").forward(request, response);
	}
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
